﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Acms.AcmsControls.ContentControls.Admin
{
    public class TrueFalseAdminDisplay : BaseAdminDisplay<TrueFalseContentControlProperties>
    {
        protected override string GetCssClass
        {
            get { return "truefalse"; }
        }

        public override void PropertiesLoaded(TrueFalseContentControlProperties properties)
        {
            base.PropertiesLoaded(properties);
            if (Properties != null)
            {
                Value = properties.Value;
            }
        }

        public bool Value { get; private set; }


        protected override object SaveViewState()
        {
            ViewState["Value"] = Value;
            return base.SaveViewState();
        }

        protected override void LoadViewState(object savedState)
        {
            base.LoadViewState(savedState);
            Value = ViewState["Value"] as bool? ?? false;
        }

        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            writer.Write(Value);
        }
    }


}
